//
// Created by Sorel on 2021/3/4.
//
#pragma once

#include <boost/random.hpp>
#include <boost/random/uniform_int.hpp>
#include <boost/random/cauchy_distribution.hpp>
#include <boost/random/normal_distribution.hpp>
#include <boost/random/uniform_real.hpp>


boost::mt19937 randomGenerator(time(0)*rand());

boost::random::uniform_real_distribution<> uniformRealDistribution(0, 1);
boost::variate_generator<boost::mt19937, boost::random::uniform_real_distribution<>> random_probability(randomGenerator, uniformRealDistribution);

/**
 * return double probability between 0 and 1
 */
double random_p() {
    return random_probability();
}

boost::random::uniform_int_distribution<> uniformIntDistribution(NULL);
boost::variate_generator<boost::mt19937, boost::random::uniform_int_distribution<>> random_integer(randomGenerator, uniformIntDistribution);

int random_int() {
    return random_integer();
}

/**
 *
 * @param min
 * @param max
 * @return random int between min and max (including min & max)
 */
int random_int(int min, int max) {
    return min + (random_integer()%(max-min+1));
}

/**
 *
 * @param min
 * @param max
 * @return random double between min and max (including min & max)
 */
double random_double(double min, double max) {
    return min + (max - min) * random_p();
}

